
<div class="templatemo-content-wrapper">
	<div class="templatemo-content">
		<ul class="nav nav-tabs mytabs">
		  
		  <li ><a href="<?=site_url()?>/category/index">分类列表</a></li>
		  <li class="active" role="presentation"><a href="<?=site_url()?>/category/add"><i class="fa fa-plus"></i> 添加分类</a></li>
		 
		</ul>
		<div class="row">
			<div class="col-md-12">
				<div class="table-responsive">
					 
					<form role="form" id="templatemo-preferences-form"
						onsubmit="return false;">
						<div class="row">
							<div class="col-md-6 margin-bottom-15">
								<label for="firstName" class="control-label">分类名称</label> <input
									type="text" class="form-control" id="name" value="">
							</div>
							<div class="col-md-6 margin-bottom-15">
								<label for="lastName" class="control-label">分类描述</label> <input
									type="text" class="form-control" id="description" value="">
							</div>
						</div>
						<div class="row templatemo-form-buttons">
							<div class="col-md-12">
								<button type="submit" class="btn btn-primary" id="submit_btn">添加</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
</div>
<script>
	$(document).ready(function() {
		$("#submit_btn").click(function() {
			var name = $("#name").val();
			var description = $("#description").val();
			$.ajax({
				url : '<?php echo site_url('category/save')?>',
				type : "post",
				async : true,
				data : {
					'name' : name,
					'description' : description
				},
				dataType : "json",
				success : function(data) {
					if(data.code)
					{
						alert(data.msg);
					}else{
						alert(data.msg);
					}
				}
			});
		});
	}); 
</script>